
file = open('E:\\file_demo111.txt',mode='r+',encoding='utf-8')
print(file)
print(file.read())
file.close()

with open('E:\\file_demo111.txt',mode='r+',encoding='utf-8') as file:
    # print(file)
    # print(file.read())
    file.close()

with open('E:\\file_demo111.txt',mode='a+',encoding='utf-8') as file:
    # print(file)
    # print(file.read())
    # file.write("\nwrite....write...write")
    file.writelines(['\n111','\naa','\nb'])
    file.close()

with open('E:\\file_demo111.txt',mode='r+',encoding='utf-8') as file:
    print(file)
    # print(file.read())
    # print(file.read(20))
    print(file.readline())
    # print(file.readlines())
    # file_list = file.readlines()
    # print(file_list)
    # for file_content in file_list:
    #     print(file_content,end='\n')
    file.close()

with open('E:\\file_demo1111.txt',mode='r+',encoding='utf-8') as file:
    print(file.tell())
    # print(file)
    # print(file.read())
    print(file.readline())
    print(file.tell())
    file.seek(3,0)
    file.close()